/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.facade.main.controller;

import com.alibaba.fastjson.JSONObject;
import com.facade.main.httpunit.HttpHelper;
import com.facade.main.httpunit.HttpProperty;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author Administrator
 */
@RestController
public class OrderController {
    //接单
    @RequestMapping(value = "/order/accept", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public String orderAccept(@RequestBody JSONObject json){
        String url = String.format("%s/order/accept", HttpProperty.TESTURL);
        return HttpHelper.postData(url, json.toJSONString(), "");
    }
    
    //拒绝接单
    @RequestMapping(value = "/order/refuse", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public String orderRefuse(@RequestBody JSONObject json){
        String url = String.format("%s/order/refuse", HttpProperty.TESTURL);
        return HttpHelper.postData(url, json.toJSONString(), "");
    }
    
    //退单（接单后
    @RequestMapping(value = "/order/refund", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public String orderReefund(@RequestBody JSONObject json){
        String url = String.format("%s/order/refund", HttpProperty.TESTURL);
        return HttpHelper.postData(url, json.toJSONString(), "");
    }
    
    //开始配送
    @RequestMapping(value = "/order/express", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public String orderExpress(@RequestBody JSONObject json){
        String url = String.format("%s/order/express", HttpProperty.TESTURL);
        return HttpHelper.postData(url, json.toJSONString(), "");
    }
}
